﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace WEALTH.Manager.BaseSystem
{
    public partial class RoleInsert : BasePage
    {
        ExcuteDao groupmenu = new ExcuteDao();
        public string strMsg = "", strLink = "", strSessCode = "";
        public int n = 0;

        protected void Page_Load(object sender, EventArgs e)
        {
            strSessCode = Request.QueryString["code"].ToString().Trim();
            if (!IsPostBack)
            {
                rblIsUse.SelectedValue = "1";
                txtRole_Name.Focus();
            }

        }

        protected void btnAdd_Click(object sender, EventArgs e)
        {

            string GroupName = txtRole_Name.Text.Trim();
            string PGroupCode = strSessCode.ToString().Trim();
            string IsUse = rblIsUse.SelectedValue.ToString().Trim();

            //if (GroupName.Length == 0)
            //{
            //   // Response.Write("<script>alert('请输入角色名称！');</script>");
            //    ShowMsg("请输入角色名称！");
            //    txtRole_Name.Focus();

            //    return;
            //}

            n = groupmenu.AddGroupMenu(GroupName, PGroupCode, IsUse);
            if (n > 0)
            {
                // Response.Write("<script>location.replace('RoleList.aspx?msg=新增角色成功！');</script>");
                ReturnList("RoleList.aspx", "新增角色成功！");
            }
            else
            {
                ShowMsg("新增角色失败！", 1);
                return;
            }
            return;
        }
    }
}